VBcoders Guest



Don't have an account yet? Register
 


Forgot Password?



Getting a Reference to a VB 5.0 UserControl

by Found on the World Wide Web (15 Submissions)
Category: Custom Controls/Forms/Menus
Compatability: Visual Basic 3.0
Difficulty: Unknown Difficulty
Date Added: Wed 3rd February 2021
Rating: (38 Votes)

Visual Basic 5.0 allows you to use UserControls to create ActiveX controls in your projects. The following code snippet does two things: It gets a reference to the form in which a UserControl is placed, and it gets a reference to that control on the form. by David Mendlen

Rate Getting a Reference to a VB 5.0 UserControl


Dim PControl As Object
Dim MyControl As Control
Dim AControl As Object
'Get my UserControl
For Each AControl In ParentControls
  If AControl.Name = Ambient.DisplayName Then
    Set MyControl = AControl
    Exit For
  End If
Next
'Get the Form UserControl is on
Set PControl = ParentControls.Item(1).Parent
While Not (TypeOf PControl Is Form)   Set PControl = PControl.Parent
Wend

Download this snippet    Add to My Saved Code

Getting a Reference to a VB 5.0 UserControl Comments

No comments have been posted about Getting a Reference to a VB 5.0 UserControl. Why not be the first to post a comment about Getting a Reference to a VB 5.0 UserControl.

Post your comment

Subject:
Message:
0/1000 characters